﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace genericity
{
    public class MyClass<T> where T:struct
    {
        public T Sum(T a, T b)
        {
            // dynamic:它是在程序运行的时候才知道我是什么类型
            return (dynamic)a + b;
        }

        public void Print()
        {
            Console.WriteLine($"{typeof(T).ToString()}");
        }
    }
}
